var app = angular.module('JiangGanApp')
    app.directive('hint',['$sce',hint]);

function hint($sce) {
    var directive ={
        restrict: 'AE',
        templateUrl: '../templates/directives/hintTemplate.html',
        scope:{
            hintOption:'=hintoption',
            clickSubmit:'&clicksubmit',
            clickClose:'&clickclose'
        },
        transclude:true,
        replace:true,
        link: function ($scope, element, attrs) {
            $scope.hintOption.hintinfo =  $sce.trustAsHtml($scope.hintOption.hintinfo)
            
            $scope.clickSubmitIt=function(){
                $scope.clickSubmit();
            }

            $scope.clickCloseIt=function(){
                $scope.clickClose();
                console.log($scope.hintOption)
            }

            $scope.checkKeyUp = function(e){
                console.log(e)
            var keycode = window.event ? e.keyCode : e.which;//获取按键编码  
                console.log(keycode)
            if (keycode == 13) { 
                $scope.clickSubmitIt()//如果等于回车键编码执行方法  
               
            }  
    }


        }
    }
    return directive;
}
